IF exists(SELECT * FROM dbo.sysobjects WHERE name='schooljaarKort' AND xtype='FN') 
BEGIN
	DROP FUNCTION schooljaarKort
END
GO

create function schooljaarKort (@jaar varchar(4))
returns varchar(5)
as
begin
  declare @jaarInt int
  declare @jaar2 varchar(4)
  set @jaarInt = convert(int,@jaar) + 1
  set @jaar2 = convert(varchar(4),@jaarInt)
  return(right(@jaar,2) + '-' + right(@jaar2,2))
end